import request from '@/utils/request';

export function fetchAllDrug() {
    return request({
        url: '/drug/list',
        method: 'get',
    });
}

export function fetchAllDrugByPage(drugName, page, limit) {
    return request({
        url: '/drug/listByPage',
        method: 'get',
        params: {
            drugName: drugName,
            page: page,
            limit: limit
        }
    });
}

export function addDrug(drug) {
    return request({
        url: '/drug/add',
        method: 'post',
        data: drug
    });
}

export function renewDrug(drug) {
    return request({
        url: '/drug/renew',
        method: 'post',
        data: drug
    });
}

export function removeDrug(drugId) {
    return request({
        url: '/drug/remove',
        method: 'post',
        params: {
            drugId: drugId
        }
    });
}
